Read me for: Caughey, Devin; Warshaw, Christopher, 2014, "Replication data for: Dynamic Estimation of Latent Opinion from Sparse Survey Data Using a Group-Level IRT Model", http://dx.doi.org/10.7910/DVN/27899 Dataverse [Distributor] V1 [Version]

This replication directory contains files to replicate all the analyses in the main text of our paper. The files are divided into three groups, indicated respectively by the prefixes "Lib", "Fig", and "CV".

Lib
- "Lib-CreateData.R": This file contains R code to load the raw poll data for the 1972-2012 period and transform it into the form required by the Stan model. The output produced by this code is saved as "Lib-DataForStan.RData" in the "Data" folder of this directory. **N.B. Since we do not have the right to distribute the individual-level poll data, the data files required to run this file are not included in the replication files.**
- "Lib-StanEst.R": This file contains R and Stan code required to estimate the group-level IRT model, producing estimates of citizen liberalism in every state for each year 1972-2012. It also contains code to post-process the estimates. **N.B. Estimating the model with the parameters defined in the code is very CPU and RAM intensive and may take as long as several weeks.**
- "Lib-DataForStan.RData": The .RData file created by "Lib-CreateData.R" and loaded by "Lib-StanEst.R".

Fig
This group contains the R code and data required to replicate figures 1-3 in the main text.

CV
This group of files contains R code and data required to replicate the cross-validation reported in the paper. The code file "CV-DoCV.R" sequentially reads in the ten .RData files, which contain ten different random partitions of the raw poll data into training and validation subsets, and performs the cross-validation. The .RData files themselves were created by the code file "CV-CreateData.R", which is included for reference only because we cannot share the raw data files required to run the code (see above). **N.B. Running the full cross-validation is very CPU and RAM intensive and may take as long as several weeks.**
